<template>
  <view class="w-full">
    <div class="font-bold text-sm">

      <div class="flex  items-center justify-between">
        <div class="m-2">
          <div :class="cur == 0 ? 'borderL' : ''" @click="cur = 0">全部</div>
        </div>

        <div class="m-2">
          <div :class="cur == 1 ? 'borderL' : ''" @click="cur = 1">待确认</div>
        </div>

        <div class="m-2">
          <div :class="cur == 2 ? 'borderL' : ''" @click="cur = 2">进行中</div>
        </div>

        <div class="m-2">
          <div :class="cur == 3 ? 'borderL' : ''" @click="cur = 3">已完成</div>
        </div>

        <div class="m-2">
          <div :class="cur == 4 ? 'borderL' : ''" @click="cur = 4">已取消</div>
        </div>

      </div>

      <mypublish v-for="publish in allPublishes" v-bind="publish" v-if="cur == 0" />
      <mypublish v-for="publish in ready2ComformPublishes" v-bind="publish" v-if="cur == 1" />
      <mypublish v-for="publish in doingPublishes" v-bind="publish" v-if="cur == 2" />
      <mypublish v-for="publish in finishedPublishes" v-bind="publish" v-if="cur == 3" />
      <mypublish v-for="publish in cancelPublishes" v-bind="publish" v-if="cur == 4" />


    </div>
  </view>
</template>

<style scoped>
.Line {
  border: 1px solid #8f938d;
}

.borderL {
  border-bottom: 2px solid red
}
</style>
<script setup>
import { ref, reactive } from 'vue'
import mypublish from '../../components/mypublish.vue';
import { useUserStore } from '../../stores/user'
import { onLoad } from "@dcloudio/uni-app"

const user = useUserStore()
uni.setNavigationBarTitle({ title: '镇镇求职 | ' + user.area })

const allPublishes = user.publishes
const ready2ComformPublishes = user.publishes.filter(v => v.status === "待确认")
const doingPublishes = user.publishes.filter(v => v.status === "进行中")
const finishedPublishes = user.publishes.filter(v => (v.status === "已完成"))
const cancelPublishes = user.publishes.filter(v => v.status === "已取消")
user.getMyPublish()
const cur = ref(0)
onLoad((option) => {
  cur.value = parseInt(option.cur)
  console.log(cur)
})

</script>